<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="../../../static/layui/css/layui.css" />
		<script src="../../../static/js/jquery-3.3.1.min.js"></script>

		<script>
			$(document).ready(function(){

				// 修改信息
				$('.modifyPassword').click(function () {
					$.post(
							"${pageContext.request.contextPath}/modifyStudentPassword",
							$('#modifyPasswordForm').serialize(),
							function (data) {
								if (data == 1) {
									var $url = "${pageContext.request.contextPath}" +"/jsp/admin/student/modifyPassword.jsp";
									$(window).attr('location',$url);

								}
							}
					)
				});

				$('.lookPassword').click(function () {

					if($(this).text()=="查看密码") {
						$('#nowPassword').attr("type", "text");
						$(this).text("隐藏密码");
					}else if($(this).text()=="隐藏密码"){
						$('#nowPassword').attr("type", "password");
						$(this).text("查看密码");
					}
					return false;
				});
			});
		</script>
	</head>
	<body>
		<div class="layui-card">
			<div class="layui-card-header">
				<h2>修改密码</h2>
			</div>
			<form class="layui-form" id="modifyPasswordForm">
				<div class="layui-form-item">
					<label class="layui-form-label">学生ID</label>
					<div class="layui-input-inline">
						<input type="text" name="studentId" required lay-verify="required" placeholder="不可编辑" value="${sessionScope.student.studentId}" readonly="" autocomplete="off"
						 class="layui-input">
					</div>

				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">当前密码</label>
					<div class="layui-input-inline">
						<input type="password"  value="${sessionScope.student.studentPassword}" id="nowPassword" lay-verify="required" placeholder="输入密码"  autocomplete="off"
							   class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">输入新密码</label>
					<div class="layui-input-inline">
						<input type="text" name="studentPassword"   lay-verify="required" placeholder="输入新密码"  autocomplete="off"
						 class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">再次输入</label>
					<div class="layui-input-inline">
						<input type="text" name="ConfirmPassword"  lay-verify="required" placeholder="再次输入新密码" autocomplete="off"
						 class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn modifyPassword">确定修改</button>
						<button class="layui-btn layui-bg-blue lookPassword">查看密码</button>
					</div>
				</div>

			</form>
		</div>
		<script src="../../../static/layui/layui.js"></script>
		<script>
			//Demo

			layui.use('form', function() {
				var form = layui.form;

			});
		</script>
	</body>
</html>
